package com.lst.quartz.job;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.time.LocalDateTime;

/**
 * @author shengtao
 * @Description:
 * @date 2018/12/12 12:13
 */
@DisallowConcurrentExecution
/*public class FirstJob extends QuartzJobBean {
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        System.out.println("start My first Job B：" + LocalDateTime.now()+" time :"+ System.currentTimeMillis()/1000);
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("end  My first Job B：" + LocalDateTime.now()+" time :"+ System.currentTimeMillis()/1000);
    }
}*/
public class FirstJob implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("start My first Job B：" + LocalDateTime.now()+" time :"+ System.currentTimeMillis()/1000);
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("end  My first Job B：" + LocalDateTime.now()+" time :"+ System.currentTimeMillis()/1000);
    }
}
